package com.handc.springcloud.controller;



import com.handc.springcloud.pojo.Student;
import com.handc.springcloud.service.StudentClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;

@RestController
public class DeptConsumerController {

    @Autowired
    private StudentClientService studentClientService;


    @RequestMapping("/consumer/stu/add")
    public boolean add(Student student){
        return this.studentClientService.addStudent(student);
    }

    @RequestMapping("/consumer/stu/get/{id}")
    public Student get(@PathVariable("id") Long id){
        return this.studentClientService.queryById(id);
    }

    @RequestMapping("/consumer/stu/list")
    public List<Student> list(){
        return this.studentClientService.queryAll();
    }

}
